import time #библиотека подсчёта времени

def bubble(numbers):
    sw = True
    while sw:
        sw = False
        for i in range(len(numbers)-1):
            if numbers[i]>numbers[i+1]:
                numbers[i],numbers[i+1]=numbers[i+1],numbers[i]
                sw=True
                
def read(fName,):
    file=open(fName,'r')
    data=file.readlines()
    return data

m1=read('m1_sorted.txt')
m2=read('m2_reverse.txt')
m3=read('m3_shuffle.txt')
#

t_start=time.time()
bubble(m1)
t_finish=time.time()
print('m1_sorted',round(t_finish-t_start)*1000,'millicesonds')
#

t_start=time.time()
bubble(m2)
t_finish=time.time()
print('m2_reverse',round(t_finish-t_start)*1000,'millicesonds')
#

t_start=time.time()
bubble(m3)
t_finish=time.time()
print('m3_shuffle',round(t_finish-t_start)*1000,'millicesonds')
